"""
Project Name : api_automation_framework
File Name : deflate_demo.py
Author : lldhsds
Date : 2024/12/28 00:02
Description: /deflate, 返回一个使用 `deflate` 算法压缩的响应。`deflate` 是一种常用的压缩算法，通常用于 Web 响应。
"""

import requests

# GET: /deflate
# Returns Deflate-encoded data.
# parameters: None
# response: 200(Deflate-encoded data.)
def deflate_demo():
    response_format = 'deflate'
    url = f"https://httpbin.org/{response_format}"
    headers = {'accept': 'application/json'}
    response = requests.get(url, headers=headers)
    print(response.status_code)
    print(response.json())
    print(response.text)
    print(response.headers)
    print(response.headers.get('Content-Encoding')) # deflate
    print(response.headers['Content-Encoding']) # deflate

deflate_demo()